/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.mylhyl.zxing.scanner.scan.init;

import ohos.app.Context;
import ohos.media.image.common.Size;

import com.mylhyl.zxing.scanner.scan.util.CameraRatioUtil;

import java.util.List;

/**
 * 相机初始化、配置类
 *
 */
public class CameraInfoConfig {

    /**
     * 相机比例
     *      默认比例4:3
     */
    public static final Integer cameraRatio = CameraRatioUtil.FOUR_TO_THREE;

    /**
     * 相机预览拍照区域长宽值，根据相机比例计算
     */
    public static Size cameraSize;

    /**
     * 默认使用后置相机
     */
    public static final Integer cameraType = 0;

    /**
     * 相机支持的分辨率列表
     */
    public static List<Size> pictureSizes;

    /**
     * 根据相机拍照区域长宽值，从相机支持的分辨率列表中，得到的最佳分辨率值
     */
    public static Size pictureOptimumSize;

    /**
     * 初始化相机信息
     *
     * @param context       上下文
     */
    public static void initCameraConfig(Context context){
        // 初始化相机长宽值
        cameraSize = CameraRatioUtil.getCameraWidth(context, cameraRatio);
    }

}
